package com.xhx.shardingjdbc.controller;

import com.alibaba.druid.proxy.jdbc.PreparedStatementProxy;
import com.xhx.shardingjdbc.domain.Book;
import com.xhx.shardingjdbc.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: xh-learn-record
 * @description:
 * @author: sch
 * @create: 2023-02-28 11:45
 **/
@RestController
@RequestMapping("book")
public class BookController {
    @Autowired
    BookService bookService;

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public List<Book> getItems() {
        return bookService.getBookList();
    }

    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public Boolean saveItem(Book book) {
        return bookService.save(book);
    }

}
